class NoteController < ApplicationController
    def create  
        if request.post?
            note = Note.new()
            note.con =  params[:con]
            note.foreignkey = params[:id]
            note.message = params[:notebody]
            if note.save
                flash[:notice] = "Note created for " + note.con + " #" + note.foreignkey.to_s
                redirect_to(:controller => "equipment", :action => "list_all")
            end
        else
            @note = Note.new()
        end
        
    end
    
    def edit        
        if request.post?
            @note = Note.find_by_id(params[:id])
            @note.message = params[:notebody]
            @note.save
            redirect_to(:controller => params[:redircont], :action => params[:rediract])
        end
    end
    
    def view
        
    end
    
    def delete
        note = Note.find_by_id(params[:id])
        note.destroy
        redirect_to(:controller => params[:redircont], :action => params[:rediract])
    end
end
